
                <div class="tableMain">
                    <form method="post" action="index.php?admin=1&c=news&a=add">
                    <label>分类:</label>
                    <p class="select">
                        <select name="pid">  
                          <option value="" disabled="disabled" selected="selected">请选择</option>
                          <?php foreach ($arr as $key => $value):?>
                          <option value="<?php echo $value['id'];?>"><?php echo $value['name'];?></option>
                          <?php endforeach;?>
                        </select>
                    </p>
                    <label>标题:</label><input name="title" type="text" /><br/>
                    <label>作者:</label><input name="author" type="text" /><br/>
                    <label>内容:</label><textarea  id="textarea" name="content" cols="80" rows="12"></textarea><br/>
                    
                    <input name="add" type="submit" value="添加"/>
                    </form>  
                </div>
                <div id="page">
                <ul>
        
                </ul>
              </div>
   <script>
                $('select').live('change',function(){
                    var id=$(this).val();
                    $(this).nextAll().remove();
                    var index=$(this).get(0).selectedIndex;
                    if(!index){
                        return false;
                    }
                    var url="index.php?admin=1&c=news&a=add";
                    $.ajax({
                        type:"post",
                        url:url,
                        data:{id:id},
                        dataType:"json",
                        success:function(json){
                            //alert(json[0].name);
                            if(json[0]){
                                var str='';
                                str+='<select style="margin-left:10px;" name="pid">';
                                str+='<option value="'+id+'">上一级</option>';
                                var i;
                                for (i in json) {
                                    str+='<option value="'+json[i].id+'">'+json[i].name+'</option>';
                                };
                                str+='</select>';

                                $('.select').append(str);
                            }
                        }
                    })
                    
                })
          </script>    